package com.example.cdctestsystem.service.impl;

import com.example.cdctestsystem.mapper.KnowledgeMapper;
import com.example.cdctestsystem.pojo.Knowledge;
import com.example.cdctestsystem.service.KnowledgeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
@Service("knowledgeService")
@Transactional(rollbackFor = Exception.class)
public class KnowledgeServiceImpl implements KnowledgeService {
    @Resource
    private KnowledgeMapper knowledgeMapper;
    @Override
    public PageInfo<Knowledge> getAllKnowledge(int pageNum,int pageSize,String content) {
        PageHelper.startPage(pageNum,pageSize);
        List<Knowledge> allKnowledge = knowledgeMapper.getAllKnowledge(content);
        return new PageInfo<Knowledge>(allKnowledge,9);
    }

    @Override
    public Knowledge getKnowledgeById(int knowledgeId) {
        return knowledgeMapper.getKnowledgeById(knowledgeId);
    }


    @Override
    public void insert(Knowledge object) {

    }

    @Override
    public void delete(Integer id) {

    }

    @Override
    public void delete(String ids) {

    }

    @Override
    public void update(Knowledge object) {

    }

    @Override
    public Knowledge findById(Integer id) {
        return null;
    }

    @Override
    public List<Knowledge> findAll() {
        return null;
    }

    @Override
    public PageInfo<Knowledge> findPage(int pageSize) {
        return null;
    }
}
